package com.wit.action;

public class Page {

	private static final int firstPage = 1;
	private static final int DEFAULT_PAGE_SIZE = 10;
	
	private int pageNumber;
	private int pageSize;
	private int totalPage;
	
	public Page()
	{
		this.pageNumber = 1;
		this.pageSize = DEFAULT_PAGE_SIZE;
		this.totalPage = 0;
	}
	
	public void check()
	{
		if(pageNumber < 1)
			pageNumber = 1;
		if(pageSize < 0)
			pageSize = 0;
	}
	
	public int getFirstPage()
	{
		return firstPage;
	}
	public int getPrePage()
	{
		return pageNumber > firstPage ? pageNumber - 1 : firstPage;
	}
	public int getNextPage()
	{
		return pageNumber + 1 < totalPage ? pageNumber + 1 : totalPage;
	}
	public int getLastPage()
	{
		return totalPage;
	}
	
	/************************ Getters and Setters *************************/
	public int getPageNumber() {
		return pageNumber;
	}
	public void setPageNumber(int pageNumber) {
		this.pageNumber = pageNumber;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getTotalPage() {
		return totalPage;
	}
	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}
	
}
